package doj;

import static org.junit.Assert.assertTrue;
import robocode.control.events.BattleCompletedEvent;
import robocode.control.events.TurnEndedEvent;
import robocode.control.snapshot.IBulletSnapshot;
import robocode.control.testing.RobotTestBed;

/**
 * Tests to make sure robot uses multiple fire levels.
 * @author Jordan Do
 *
 */
public class TestFire extends RobotTestBed {
  boolean change = false;
  /**
   * Checks to make sure power isn't always 3.
   * @param event Info about the current state of the battle.
   */
  @Override public void onTurnEnded (TurnEndedEvent event) {
    
    // All active bullets belong to DojBot since SittingDuck does not fire.
    IBulletSnapshot bullets[] = event.getTurnSnapshot().getBullets();
    double bulletPower = 3;
    for (int i = 0; i < bullets.length; i++) {
      if (bulletPower != bullets[i].getPower()) {
        change = true;
      }
    }
  }
  
  /**
   * After running all matches, determine if DojBot only used one power level.
   * @param event Details about the completed battle.
   */
  @Override public void onBattleCompleted(BattleCompletedEvent event) {
    assertTrue("Not same the whole way through", change);
  }
  /**
   * Robots participating.
   * @return String with the robots names, separated by comma
   */
  @Override
  public String getRobotNames() {
    return "sample.SittingDuck,doj.DojBot";
  }
}